home *** CD-ROM | disk | FTP | other *** search
- Path: gidora.kralizec.net.au!root
- From: rosko@zeta.org.au (Ross McKay)
- Newsgroups: comp.lang.c++
- Subject: Re: for loop question
- Date: Sun, 04 Feb 1996 09:53:10 GMT
- Organization: Soft Technologies
- Message-ID: <4f1si7$2l1@gidora.kralizec.net.au>
- References: <4emqf8$470@opal.southwind.net> <4eor22$r83@dub-news-svc-5.compuserve.com> <00001a81+000098cc@msn.com>
- Reply-To: rosko@zeta.org.au
- NNTP-Posting-Host: dialup48.syd1.zeta.org.au
- X-Newsreader: Forte Free Agent 1.0.82
-
- mgerrans@msn.com (Matt Gerrans) wrote:
-
- >...Actually, it's more like "do the loop *then* do the third" part of
- >the for, since the third (usually increment) part is done after the
- >body of the loop.
-
- No, actually its:
-
- a) do the initialising bit;
- b) while (condition) do
- c) statement;
- d) "increment" (or otherwise)
-
- The "middle" bit (test condition) is executed before the statement, so
- if I write:
-
- for (int i = 0; i > 0; i++)
- cout << "this will never print" << endl;
-
- there will be no output.
-
- ------------------------------------------------------------------
- Ross McKay | snail: GPO Box 562, Sydney NSW 2001 Australia
- Soft Technologies | email: mailto:rosko@zeta.org.au
- Sydney, Australia | URL: http://www.zeta.org.au/~rosko
- ------------------------------------------------------------------
- The opinions expressed are my own, not those of Soft Technologies.
- "The beatings will continue, until staff morale improves."
-
-